//
//  CollectionViewCell.m
//  盘盈贷1.2
//
//  Created by iOS on 15/3/6.
//  Copyright (c) 2015年 iOS. All rights reserved.
//

#import "CollectionViewCell.h"

@implementation CollectionViewCell
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        
        CGFloat width =  self.contentView.frame.size.width;
        CGFloat height = self.contentView.frame.size.height;
        
        NSString *a = self.list.BidAmount;
        float b = [a floatValue];
        NSString *c = self.list.Amount;
        float d = [c floatValue];
        CGFloat result1 = (b / d) * 100;
        CGFloat result = b / d;
        self.progress = [[THCircularProgressView alloc] initWithCenter:CGPointMake(width / 8, height / 4.5) radius:width / 4 lineWidth:7 progressMode:THProgressModeFill progressColor:[UIColor redColor] progressBackgroundMode:THProgressBackgroundModeCircumference progressBackgroundColor:[UIColor lightGrayColor] percentage:result];
        self.progress.centerLabelVisible = YES;
        self.progress.backgroundColor = [UIColor whiteColor];
        
        self.progress.centerLabel.text = [NSString stringWithFormat:@"%.0f %%%", result1];
        
        [self.contentView addSubview:self.progress];
        
        self.nameTitle = [[UILabel alloc] init];
        [self.contentView addSubview:self.nameTitle];
        [self.nameTitle release];
        
        self.jiekuan = [[UILabel alloc] init];
        [self.contentView addSubview:self.jiekuan];
        [self.jiekuan release];
        
        self.lilv = [[UILabel alloc] init];
        [self.contentView addSubview:self.lilv];
        [self.lilv release];
        
        self.time = [[UILabel alloc] init];
        [self.contentView addSubview:self.time];
        [self.time release];
        
        self.qixian = [[UILabel alloc] init];
        [self.contentView addSubview:self.qixian];
        [self.qixian release];
    }
    return self;
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.nameTitle.frame = CGRectMake(50, 0, 90, 40);
    self.nameTitle.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
    self.nameTitle.numberOfLines = 0;
    self.jiekuan.frame = CGRectMake(50, 40, 90, 20);
    self.jiekuan.font = [UIFont systemFontOfSize:12];
    self.lilv.frame = CGRectMake(50, 60, 90, 20);
    self.lilv.font = [UIFont systemFontOfSize:12];
    self.time.frame = CGRectMake(50, 80, 110, 20);
    self.time.font = [UIFont systemFontOfSize:12];
    self.qixian.frame = CGRectMake(50, 100, 90, 20);
    self.qixian.font = [UIFont systemFontOfSize:12];
}
@end
